$("#error_content").hide();

browser.tabs.executeScript({file: "content-script.js"})
    .then(function () {
        $("#check_cert").bind("click", function () {
            browser.tabs.query({active: true, currentWindow: true})
                .then((tabs) => {
                    browser.tabs.sendMessage(tabs[0].id, {
                        command: "check_cert",
                    });
                })
                .catch((error) => {
                    console.error(`Could not beastify: ${error}`);
                });
        });
    })
    .catch((error) => {
        $("#main_content").hide();
        $("#error_content").html(error).show();
        console.error(`Failed to execute beastify content script: ${error.message}`);
    });
